<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新品有戏后台管理</title>
    <link href="__CSS__/boot.css" rel="stylesheet">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <style>
        th{
            text-align: center;
            vertical-align: middle!important;
        }
    </style>
</head>
<body>
{include file="base/header" /}

<div style="float: right; margin-top: 5px;margin-bottom: 5px" class="box-title ">
    <form class="form-inline" action="{:url('index/shop/detail')}" method="get">
        <input type="hidden" name="sid" value="{$sid}"/>
        <input type="text" name="ordernumber" value="<?php if(isset($ordernumber)) echo $ordernumber ?>" class="form-control" id="exampleInputEmail3" >
        <input type="submit" class="btn btn-default" value="搜索"/>
        <input type="button" onclick="res({$sid},{$ordernumber})" value="全部显示" class="btn btn-default"/>
    </form>
</div>
<table class="table table-bordered" style="width: 1300px;margin: 0 auto">
    <tr>
        <!--<th>编号</th>-->
        <th>商品名称</th>
        <th>商家联系人</th>
        <th>订单号</th>
        <th>下单日期</th>
        <th>进价(元)</th>
        <th>售价(元)</th>
        <th>合计(元)</th>
        <th>实际合计(元)</th>
        <th>购买数量(个)</th>
        <th>订单号</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    {foreach $result as $val}
    <tr id="del{$val.id}" style="text-align: center">
        <!--<td>{$val.id}</td>-->
        <td>{$val.pname}</td>
        <td>{$val.linkman}</td>
        <td>{$val.ordernumber}</td>
        <td>{$val.date}</td>
        <td>{$val.purchaseprice}</td>
        <td>{$val.retailprice}</td>
        <td>{$val.total}</td>
        <td>{$val.actualtotal}</td>
        <td>{$val.number}</td>
        <td>{$val.ordernumber}</td>
        <td>{if $val.status == 1} 购买申请中 {elseif $val.status == 2 /} 购买通过  {elseif $val.status == 3 /} 邮寄中 {elseif $val.status == 4 /}货已到 {elseif $val.status==5/} 已完成 {/if}</td>
        <td>
            <button onclick="orderdetail({$val.id},{$sid})" type="button" class="btn btn-primary btn-xs" >订单详情</button>
            <button onclick="damage({$val.id})" type="button" class="btn btn-warning btn-xs" >损坏</button>
        </td>
    </tr>
    {/foreach}
</table>
<div style="margin-left: 30px">{$result->render()}</div>
</body>
<script>
    //添加损坏产品的数量
    function damage(id) {
        window.location.href = "{:url('index/shop/damage')}?id="+id;
    }
    //订单详情
    function orderdetail(id,sid) {
        window.location.href = "{:url('index/shop/orderDetail')}?id="+id+"&sid="+sid;
    }
    //显示全部
    function res(sid,ordernumber) {
        window.location.href = "{:url('index/shop/detail')}?sid="+sid+"&ordernumber="+ordernumber;
    }
</script>
</html>